package com.tianzhu.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.validator.constraints.NotEmpty;

import com.fasterxml.jackson.annotation.JsonIgnore;


/**
 * The persistent class for the CUTOMER database table.
 * 
 */
@Entity
@Table(name="CUSTOMER")
@NamedQuery(name="Customer.findAll", query="SELECT c FROM Customer c")
public class Customer implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="CUTOMER_ID_GENERATOR", sequenceName="CUSTOMER_S")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CUTOMER_ID_GENERATOR")
	@Column(unique=true, nullable=false, precision=38)
	private Long id;

	
	@NotEmpty (message = "The customer email must not be null")
	@Column(name="CUSTOMER_EMAIL", nullable=false)
	private String customerEmail;
	
	@NotEmpty (message = "The customer name must not be null")
	@Column(name="CUSTOMER_NAME", nullable=false)
	private String customerName;

	@Column(name="CUSTOMER_PHONE", length=100)
	private String customerPhone;
	
	@Column(name="USERNAME")
	@NotEmpty (message = "The customer username must not be null")
    private String username;
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getEnabled() {
		return enabled;
	}

	public void setEnabled(Integer enabled) {
		this.enabled = enabled;
	}

	@Column(name="PASSWORD")
    @NotEmpty (message = "The customer password must not be null")
    private String password;

	@Column(name="ENABLE")
    private Integer enabled;
	
	@OneToOne
    @JoinColumn(name = "BILLINGADDRESSID")
    private Billingaddress billingAddress;

    @OneToOne
    @JoinColumn(name = "SHIPPINGADDRESSID")
    private Shippingaddress shippingAddress;

    @OneToOne
    @JoinColumn(name = "CARTID")
    @JsonIgnore
    private Cart cart;
	

	public Customer() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCustomerEmail() {
		return this.customerEmail;
	}

	public void setCustomerEmail(String customerEmail) {
		this.customerEmail = customerEmail;
	}

	public String getCustomerName() {
		return this.customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getCustomerPhone() {
		return this.customerPhone;
	}

	public void setCustomerPhone(String customerPhone) {
		this.customerPhone = customerPhone;
	}
	

    public Billingaddress getBillingAddress() {
        return billingAddress;
    }

    public void setBillingAddress(Billingaddress billingAddress) {
        this.billingAddress = billingAddress;
    }

    public Shippingaddress getShippingAddress() {
        return shippingAddress;
    }

    public void setShippingAddress(Shippingaddress shippingAddress) {
        this.shippingAddress = shippingAddress;
    }

    public Cart getCart() {
        return cart;
    }

    public void setCart(Cart cart) {
        this.cart = cart;
    }

}